# Required functions: `srs.ratio`, `srs.ratio.mean`, `srs.ratio.total` uspop=read.table("http://www.webpages.uidaho.edu/%7Erenaes/Data/R%20Data%20files/USpop.txt",sep='',header=T) View(uspop) set.seed(59373); library(sampling) # fixing the same errors we did with StRS uspop=uspop[-1,] uspop[uspop$State=='Delaware',] uspop[uspop$State=='Delaware','Total']<-807385 uspop[uspop$State=='Delaware','Y1824']<-81501 N=50; n=16 s=srswor(n,N) srs=(1:N)[s==1] uspop.srs=uspop[srs,] View(uspop.srs) # Not necessary but makes things a tad easier poptot=uspop.srs$Total; pop1824=uspop.srs$Y1824 n=length(poptot); N=50 mux=287002236/N ratio.srs('uspop.srs',poptot,pop1824,n,N,mux) muhaty.srs('uspop.srs',poptot,pop1824,n,N,mux) # if you do not have taux, use N*mux. If you do not have either, # use xbar as your mux estimate and then taux=N*xbar taux=287002236 tauhaty.srs('uspop.srs',poptot,pop1824,n,N,taux)